import axios from 'axios';


const instance = axios.create({
    baseURL: "http://1.116.129.31:3000/",
    timeout: 1000
})


instance.interceptors.request.use(config => {
    const token = sessionStorage.getItem("token");
    config.headers["authorization"] = token;
    return config;
})

instance.interceptors.response.use(config => {
    return new Promise((resolve , reject) => {
        if(config.data.status==200){
            resolve(config)
        }else{
            reject(config.data.infomation)
        }
    })
   
})

export default instance